from datetime import datetime
import time

def print_time_delta(start_time,end_time):
    if(isinstance(start_time,float)):
        start_time = datetime.fromtimestamp(start_time)
    if(isinstance(start_time,float)):
        end_time = datetime.fromtimestamp(end_time)
    # 获取时间差的小时、分钟和秒
    delta = end_time - start_time
    hours = delta.seconds // 3600
    minutes = (delta.seconds // 60) % 60
    seconds = delta.seconds % 60
    # 输出时间差
    print("耗时 {}小时 {}分钟 {}秒".format(hours, minutes, seconds))
    
start_time = time.time()
print(type(start_time))
time.sleep(1)
end_time = datetime.now()

print_time_delta(start_time,end_time)

